﻿//
// Created by Administrator on 2020/9/8.
//

#include "Student2.h"

Student2::Student2(const char *name, const int age, const char *school, std::valarray<int> scoreArr) :
        Person2(name, age), school(school), score(scoreArr) {

}

Student2::~Student2() {
    std::cout << "free Student2" << std::endl;
}

void Student2::toString() {
    using std::cout;
    using std::endl;

    cout << "Student2 [name:" << getName() << ", age:" << getAge() << ", school:" << this->school << ", score:"
         << score.sum() << "]" << endl;
}

std::ostream &operator<<(std::ostream &os, const Student2 &student2) {
    os << "student2 <<[name:" << student2.getName() << ", age:" << student2.getAge() << ", school:" << student2.school
       << ", score:" << student2.score.sum() << "]\n";
    return os;
}